package com.generator.module.mapper;

import com.generator.module.entity.Student;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface StudentMapper {

        // 根据ID查询（逻辑未删除）
        @Select("select * from student where id =#{id} and is_deleted = 0")
            Student getById(@Param("id") Long id);

        // 根据ID查询（包含已删除）
        @Select("select * from student where id =#{id}")
            Student extractById(@Param("id") Long id);

        // 插入
        int insert(@Param("student") Student student);

        // 更新
        int update(@Param("student") Student student);

        // 逻辑删除
        @Update("update student set is_deleted = 1, update_time=#{time} where id = #{id} limit 1 ")
        int delete(@Param("id") Long id, @Param("time") Integer time);
        }